import request from '@/utils/request'
// mode :cart =>obj cartIds
// mode:buyNow =>obj {goodsId,goodsNum,goodsSkuId}
export const checkOrder = (mode, obj) => {
  return request.get('http://smart-shop.itheima.net/index.php?s=/api/checkout/order', {
    params: {
      mode,
      delivery: 10,
      couponId: 0,
      isUsePoints: 0,
      ...obj
    }
  })
}
// 提交订单
// mode:cart =>obj{cartIds,remark}
// mode :buyNow =>obj(goodsId,goodsNum,goodsSkuId,remark)
export const submitOrder = (mode, obj) => {
  return request.post('http://smart-shop.itheima.net/index.php?s=/api/checkout/submit', {
    mode,
    delivery: 10,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    ...obj
  })
}
export const getMyOrderList = (dataType, page) => {
  return request.get('http://smart-shop.itheima.net/index.php?s=/api/order/list', {
    params: {
      dataType,
      page
    }
  })
}
